/*
作者：李宁（蒙娜丽宁）
获得更多精彩文章和视频，请关注我的微信公众号：极客起源
配套鸿蒙（HarmonyOS）视频教程：https://www.bilibili.com/video/BV1mv411179B
别忘了一键三连哦！

更多精彩视频，请关注我的B站：https://space.bilibili.com/477001733


copyright 2020-2025
*/

package com.example.myapplication.slice;

import com.example.PhoneHap.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class SliceDemo extends AbilitySlice {
    private Text txtLog;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_slice_layout);

        txtLog = (Text) findComponentById(ResourceTable.Id_log);
        if(txtLog != null) {
            txtLog.setMultipleLine(true);
            txtLog.append("onStart\n");
        }
    }

    @Override
    protected void onActive() {
        super.onActive();
        txtLog.append("onActive\n");
    }

    @Override
    protected void onInactive() {
        super.onInactive();
        txtLog.append("onInactive\n");
    }

    @Override
    protected void onForeground(Intent intent) {
        super.onForeground(intent);
        txtLog.append("onForeground\n");
    }

    @Override
    protected void onBackground() {
        super.onBackground();
        txtLog.append("onBackground\n");
    }

    @Override
    protected void onStop() {
        super.onStop();
        txtLog.append("onStop\n");
    }
}
